package com.bz.item.controller;

import com.bz.item.service.ItemCategoryService;
import com.bz.pojo.TbItemCat;
import com.bz.vo.CatNodeVo;
import com.bz.vo.CatVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/service/itemCategory")
public class ItemCategoryController {

    @Autowired
    private ItemCategoryService itemCategoryService;

    /**
     * 根据分类id查询子分类
     * @param id
     * @return
     */
    @GetMapping("/selectItemCategoryByParentId")
    public List<TbItemCat> selectItemCategoryByParentId(@RequestParam Long id){
        return itemCategoryService.selectItemCategoryByParentId(id);
    }

    /**
     *查询首页商品分类
     * @return
     */
    @RequestMapping("/selectItemCategoryAll")
    public CatVo selectItemCategoryAll(){
        return itemCategoryService.selectItemCategoryAll();
    }
}
